<template>
  <div class="itemlist">
    <div class="item-selector">
       <check-box :isActive="listitem.checked" @click.native="check"/>
    </div>
    <div class="item-img">
      <img :src="listitem.image" alt="商品图片">
    </div>
    <div class="item-info">
      <div class="item-title"><h3>{{listitem.title}}</h3></div>
      <div class="item-desc">{{listitem.desc}}</div>
      <div class="bottom">
        <div class="item-price">￥{{listitem.price}}</div>
        <div class="item-count">X{{listitem.count}}</div>
      </div>
    </div>
  </div>
</template>

<script>
  import CheckBox from 'components/content/checkbox/CheckBox.vue'
  export default {
    name: "shopcart-list-item",
    props:{
      listitem:{

      }
    },
    components:{
      CheckBox
    },
    methods:{
      check(){
        this.listitem.checked = !this.listitem.checked
      }
    }
  }
</script>

<style scoped>
  .itemlist{
    display: flex;
    width: 100%;
  }
  .item-selector{
    display: flex;
    align-items: center;
    justify-content: center;
    width: 12%;
  }
  .item-info{
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 10px;
  }
  .item-title{
    margin-right: 10px;
  }
  .item-desc{
    margin-top: 20px;
    font-size: 10px;
  }
  .item-img {
    padding: 5px;
  }
  .item-img img {
    display: block;
    width: 80px;
    height: 100px;
    border-radius: 5px;
    object-fit: cover;
  }
  .bottom{
    margin-top: 20px;
    display: flex;

  }
  .item-price{
    text-align: left;
    flex: 1;
    color: orange;
  }
  .item-count{
    margin-right: 8px;
    text-align: right;
    flex: 1;
  }
</style>
